#ifndef _MYTCPSERVER_H_
#define _MYTCPSERVER_H_

#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h> 　
#include <sys/types.h> 　
#include <signal.h>

#include "glog/logging.h"

typedef void(*ProcessConnectCallBack)(int fd) ;

class SocketServer
{
public:
    int  m_nSockFd;
    int  m_nPort;
    int  m_nNewfd;
    int  m_nSize ;

    struct sockaddr_in s_addr;
    struct sockaddr_in c_addr;


public:
    SocketServer(int);
    ~SocketServer();

public:
    bool m_bCreatSocket();
    bool m_bBindPort();
    bool m_bListen();
    int  m_bAccept();

public:
    void Init();
    bool Start();

    void GetNewConnect();
    void SetProcessConnectCallBack(ProcessConnectCallBack pRun);
};

void Perr(int signum);
void *ThreadGetNewConnect(void*p);
void *ThreadCallBack(void*p);
#endif // _MYTCPSERVER_H_
